'use strict';
// Copyright 2014 Blueant Inc. All Rights Reserved.

/**
 * @fileoverview 副本
 * @author sundbcn@gmail.com (sun debing)
 */

var moment = require('moment');
var _ = require('lodash');
var modelUtil = require('../util/modelUtil');
var mongoConnector = require('../libs/mongodb/mongoConnector');
/* jshint unused:false */
var copySchema = require('../schemas/copySchema');
var Copy = mongoConnector().model('Copy');

/**
 * 根据解决id获取副本数据
 * @param  {[type]}   role_id [description]
 * @param  {Function} cb      [description]
 * @return {[type]}           [description]
 */
module.exports.getByRoleId = function (role_id, cb) {
    modelUtil.getByRoleId(Copy, role_id, function (err, copy_model) {
        if (!!err) {
            console.error(err);
            return cb(err);
        }

        cb(null, copy_model);
    });
};

/**
 * 5点刷新
 */
module.exports.onFiveRefresh = function (self, cb) {
    self.refresh();
    cb();
};
